1. Given a list of integers, find the sum of all elements.
  2. Write a program to remove all duplicates from a list of strings.
  3. Create a function that takes a list of numbers and returns a new list with only the even numbers.
  4. Given two lists, find the common elements between them.
  5. Implement a function to merge two sorted lists into a single sorted list.
  6. Create a program to find the maximum and minimum values in a list of floats.
  7. Write a function that takes a list of strings and returns the longest string in the list.
  8. Create a program to count the occurrences of each word in a given sentence using a list.
  9. Given a list of names, sort them in alphabetical order.
  10. Implement a function that takes a list of numbers and returns a new list with the squared values of each element.
  11. Multiply all elements in a list.
  12. Insert an element at a specific index in the list.
  13. Remove an element from the list by its value.
  14. Remove an element from the list by its index.
  15. Find the index of the first occurrence of a specific element in the list.
  16. Find the index of the last occurrence of a specific element in the list.
  17. Reverse a list.
  18. Check if a list is empty.

  1. Find the sum of all elements in a list of integers:
function findSum(list) {
  return list.reduce((sum, num) => sum + num, 0);
}
  1. Remove duplicates from a list of strings:
function removeDuplicates(list) {
  return Array.from(new Set(list));
}
  1. Return a new list with only the even numbers:
function filterEvenNumbers(list) {
  return list.filter(num => num % 2 === 0);
}
  1. Find common elements between two lists:
function findCommonElements(list1, list2) {
  return list1.filter(item => list2.includes(item));
}
  1. Merge two sorted lists into a single sorted list:
function mergeSortedLists(list1, list2) {
  return [...list1, ...list2].sort((a, b) => a - b);
}
  1. Find maximum and minimum values in a list of floats:
function findMinMaxValues(list) {
  const max = Math.max(...list);
  const min = Math.min(...list);
  return { max, min };
}
  1. Find the longest string in a list of strings:
function findLongestString(list) {
  return list.reduce((longest, current) => current.length > longest.length ? current : longest, '');
}
  1. Count occurrences of each word in a sentence using a list:
function countWordOccurrences(sentence) {
  const words = sentence.split(' ');
  const wordCount = {};
  words.forEach(word => {
    wordCount[word] = (wordCount[word] || 0) + 1;
  });
  return wordCount;
}
  1. Sort a list of names in alphabetical order:
function sortNamesAlphabetically(names) {
  return names.sort();
}
  1. Return a new list with squared values of each element:
function squareList(list) {
  return list.map(num => num * num);
}
  1. Multiply all elements in a list:
function multiplyListElements(list) {
  return list.reduce((product, num) => product * num, 1);
}
  1. Insert an element at a specific index in the list:
function insertAtIndex(list, index, element) {
  list.splice(index, 0, element);
  return list;
}
  1. Remove an element from the list by its value:
function removeByValue(list, value) {
  return list.filter(item => item !== value);
}
  1. Remove an element from the list by its index:
function removeByIndex(list, index) {
  list.splice(index, 1);
  return list;
}
  1. Find the index of the first occurrence of a specific element:
function findFirstIndex(list, element) {
  return list.indexOf(element);
}
  1. Find the index of the last occurrence of a specific element:
function findLastIndex(list, element) {
  return list.lastIndexOf(element);
}
  1. Reverse a list:
function reverseList(list) {
  return list.reverse();
}
  1. Check if a list is empty:
function isListEmpty(list) {
  return list.length === 0;
}